<?php
set_time_limit(0);

$i = 0;
while (true) {
    $i ++;
    $file = fopen('./log/test.log', 'a');
    $txt = $i . ' --- ' . date('Y-m-d H:i:s', time()) . "\n";
    fwrite($file, $txt);
    fclose($file);
    sleep(1);
    if ($i > 20) {
        break;
    }
}
echo 'over';